package no.uia.IKT508.XH;

import org.alljoyn.bus.Status;

import android.media.AudioFormat;
import android.util.Log;
import android.widget.Toast;

public class XHVariable {

	//the connection state
	public static enum State
	{
		ATTACHMENTED,
		DISCONNECTED,
		CONNECTED_S,
		CONNECTED_C,
		ADVERTISING,
		DISCOVERING
	}
	
	//the common command
	public static final int CONNECT = 0;
	public static final int DISCONNECT = 1;
	
	//the command of client
	public static final int DISCOVER = 2;
	public static final int JOIN = 3;
	public static final int JOINED = 4;
	
	//the command of service
	public static final int ADVERTISE = 5;
	
	
	//the prefix of well name
	public static final String NAME_PREFIX = "no.uia.IKT508.XH.Chat";

	//the port of connection
	public static final short CONTACT_PORT_1 = 36;
	public static final short CONTACT_PORT_2 = 42;
	
	//the object path
	public static final String OBJECT_PATH = "/XHChat"; 
	
	//for the audio
	public static final int frequency = 44100;  
    public static final int channelConfiguration = AudioFormat.CHANNEL_CONFIGURATION_MONO;  
    public static final int audioEncoding = AudioFormat.ENCODING_PCM_16BIT;
    
    public static final int timerDelay = 50;	//50ms
	
	//Log record
	public static void logStatus(String TAG, String msg, Status status)
	{
		String log = String.format("%s : %s", msg, status);
		if (status == Status.OK)
		{
			Log.i(TAG, log);
		}
		else
		{
//			Toast.makeText(getApplicationContext(), log, Toast.LENGTH_LONG).show();
			Log.e(TAG, log);
		}
	}
}
